home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / mach / amiga / scsi9091.lzh / tester.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-10  |  680 b   |  48 lines

  1. #include <exec/types.h>
  2. #include <exec/ports.h>
  3.  
  4. #include <inline/exec.h>
  5.  
  6. #include <setjmp.h>
  7.  
  8. jmp_buf jb;
  9.  
  10. extern struct MsgPort *CreatePort();
  11.  
  12. _abort()
  13.   longjmp(jb, 1);
  14. }
  15.  
  16. main()
  17. {
  18.   struct MsgPort *mp;
  19.   struct Message *ms;
  20.   
  21.   if (mp=CreatePort("debug.port",0))
  22.     {
  23.       if (setjmp(jb))
  24.     {
  25.       Forbid();
  26.       /* since ^C is checked during IO, puts() is probably interrupted.. */
  27.       if (ms) ReplyMsg(ms);
  28.       while (ms = GetMsg(mp)) ReplyMsg(ms);
  29.       DeletePort(mp);
  30.       Permit();
  31.       exit(1);
  32.     }
  33.  
  34.       for (;;)
  35.         {
  36.           WaitPort(mp);
  37.           while (ms = GetMsg(mp))
  38.         {
  39.           puts(*(char **)&ms[1]);
  40.           ReplyMsg(ms);
  41.           ms = 0;
  42.         }
  43.     }
  44.     }
  45. }
  46.  
  47.